package com.shine.commonlibrary.utils.basebean;

import java.io.Serializable;

/**
 * Created by M_genius on 2017/9/6 16:21.
 * 描述：
 */

public class BaseResponse<T> implements Serializable {
    private int success;
    private Message message;
    private T data;

    public int getSuccess() {
        return success;
    }

    public void setSuccess(int success) {
        this.success = success;
    }

    public Message getMsg() {
        return message;
    }

    public void setMsg(Message msg) {
        this.message = msg;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public boolean isOk() {
        return success > 0 && message.getData().equalsIgnoreCase("成功");
    }
    public String getID() {
        return message.getID();
    }
    public String getErrorMsg() {
        return message.getData();
    }

    /**

     "ID":"000",
     "code":"",
     "data":"成功"

     */
    public static class Message {

        private String ID;
        private String code;
        private String data;
        public String getID() {
            return ID;
        }
        public void setID(String ID) {
            this.ID = ID;
        }
        public String getCode() {
            return code;
        }
        public void setCode(String code) {
            this.code = code;
        }
        public String getData() {
            return data;
        }
        public void setData(String data) {
            this.data = data;
        }

        @Override
        public String toString() {
            return "Message{" +
                    "ID='" + ID + '\'' +
                    ", code='" + code + '\'' +
                    ", data='" + data + '\'' +
                    '}';
        }
    }
}

